package controller;

import exception.SomeException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ExceptionController {

    @ExceptionHandler(SomeException.class)
    public ModelAndView exceptionHandler(SomeException e){
        System.out.println("ExceptionController.exceptionHandler()");
        return new ModelAndView("exception","exception",e);
    }


    @RequestMapping("/exception")
    public void f() throws Exception {
        System.out.println("ExceptionController.f()");
        throw new SomeException("SomeException...");
        // throw new Exception("Exception...");
    }

}
